<?php

namespace Queue\Task;

use Queue\Interfaces\TaskInterface;

final class EchoTask implements TaskInterface
{
    private string $text;

    public function __construct(string $text)
    {
        $this->text = $text;
    }

    public function execute(): void
    {
        echo $this->text . "\n";
    }

    public function serialize(): string
    {
        return \serialize($this->text);
    }

    public function unserialize(string $serialized): mixed
    {
        $text = \unserialize($serialized);

        $this->text = $text;
    }
}
